# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Monitoring.V3.Model.WindowsBasedSli do
  @moduledoc """
  A WindowsBasedSli defines good_service as the count of time windows for which the provided service was of good quality. Criteria for determining if service was good are embedded in the window_criterion.

  ## Attributes

  *   `goodBadMetricFilter` (*type:* `String.t`, *default:* `nil`) - A monitoring filter (https://cloud.google.com/monitoring/api/v3/filters) specifying a TimeSeries with ValueType = BOOL. The window is good if any true values appear in the window.
  *   `goodTotalRatioThreshold` (*type:* `GoogleApi.Monitoring.V3.Model.PerformanceThreshold.t`, *default:* `nil`) - A window is good if its performance is high enough.
  *   `metricMeanInRange` (*type:* `GoogleApi.Monitoring.V3.Model.MetricRange.t`, *default:* `nil`) - A window is good if the metric's value is in a good range, averaged across returned streams.
  *   `metricSumInRange` (*type:* `GoogleApi.Monitoring.V3.Model.MetricRange.t`, *default:* `nil`) - A window is good if the metric's value is in a good range, summed across returned streams.
  *   `windowPeriod` (*type:* `String.t`, *default:* `nil`) - Duration over which window quality is evaluated. Must be an integer fraction of a day and at least 60s.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :goodBadMetricFilter => String.t() | nil,
          :goodTotalRatioThreshold =>
            GoogleApi.Monitoring.V3.Model.PerformanceThreshold.t() | nil,
          :metricMeanInRange => GoogleApi.Monitoring.V3.Model.MetricRange.t() | nil,
          :metricSumInRange => GoogleApi.Monitoring.V3.Model.MetricRange.t() | nil,
          :windowPeriod => String.t() | nil
        }

  field(:goodBadMetricFilter)
  field(:goodTotalRatioThreshold, as: GoogleApi.Monitoring.V3.Model.PerformanceThreshold)
  field(:metricMeanInRange, as: GoogleApi.Monitoring.V3.Model.MetricRange)
  field(:metricSumInRange, as: GoogleApi.Monitoring.V3.Model.MetricRange)
  field(:windowPeriod)
end

defimpl Poison.Decoder, for: GoogleApi.Monitoring.V3.Model.WindowsBasedSli do
  def decode(value, options) do
    GoogleApi.Monitoring.V3.Model.WindowsBasedSli.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Monitoring.V3.Model.WindowsBasedSli do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
